<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Leveraging Parameter Names</title></head>
<body>
<p>This is where the type alone is not enough to indicate which
    dependency should be put one or more constructor args. The following
    component has a need for two of the same type, with some subtly
    different characteristics.</p>

<div class="source">
  <pre>public class AppleProcessor {
  private Apple dessertApple;
  private Apple cookingApple;

  public inject(Apple dessertApple, Apple cookingApple) {
    this.dessertApple = dessertApple;
    this.cookingApple = cookingApple;
  }
  // other methods
}

pico.addComponent("dessertApple", GoldenDeliciousApple.class);
pico.addComponent("cookingApple", BramleyApple.class);
pico.as(Characteristics.USE_NAMES).addComponent(AppleProcessor.class);

AppleProcessor appleProcessor = pico.getComponent(AppleProcessor.class);</pre>
</div>
<p>In this case the constructor to AppleProcessor has carefully named
    parameters - 'dessertApple' and 'cookingApple'. This is picked up on
    for the two named components GoldenDeliciousApple and BramleyApple also
    set up in the container.</p>

<p>There are two ways for this to work:</p>
<ul>
    <li>relying on the fact that your component classes have debug info compiled into them.</li>
    <li>post-processing component classes with <a href="http://paranamer.codehaus.org/">Paranamer</a> before placing
        them in their jar
    </li>
</ul>


</body>
</html>